﻿using Wicresoft.Common;
using System.Data;

/// <summary>
/// Summary description for AttendenceType
/// </summary>
[Table("AttendenceType", "", "Attendences.ConnectionString")]
public class AttendenceType : Info
{
    #region SQL column name consts
    public const string SQLCOL_ID = "ID";
    public const string SQLCOL_NAME = "Name";
    public const string SQLCOL_STARTHOUR = "StartHour";
    public const string SQLCOL_STARTMIN = "StartMin";
    public const string SQLCOL_ENDHOUR = "EndHour";
    public const string SQLCOL_ENDMIN = "EndMin";
    #endregion


    #region Contructors
    /// <summary>
    /// Construct empty entity
    /// </summary>
    public AttendenceType() { }

    /// <summary>
    /// Construct entity by primary key, other fields will be assigned by 
    /// "Load" method.
    /// </summary>
    public AttendenceType(int ID)
    {
        this.ID = ID;
    }
    #endregion

    public override void Init(DataRow row)
    {
        ID = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_ID]);
        Name = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_NAME]);
        StartHour = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_STARTHOUR]);
        StartMin = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_STARTMIN]);
        EndHour = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_ENDHOUR]);
        EndMin = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_ENDMIN]);
    }

    #region Properties
    #region Property <int> ID
    [Property("ID", 4, SqlDbType.Int, false, true)]
    public int ID
    {
        get { return _ID; }
        set { _ID = value; }
    }
    private int _ID = int.MinValue;
    #endregion

    #region Property <string> Name
    [Property("Name", 100, SqlDbType.NVarChar, false, false)]
    public string Name
    {
        get { return _Name; }
        set { _Name = value; }
    }
    private string _Name = null;
    #endregion

    #region Property <int> StartHour
    [Property("StartHour", 4, SqlDbType.Int, false, false)]
    public int StartHour
    {
        get { return _StartHour; }
        set { _StartHour = value; }
    }
    private int _StartHour = int.MinValue;
    #endregion

    #region Property <int> StartMin
    [Property("StartMin", 4, SqlDbType.Int, false, false)]
    public int StartMin
    {
        get { return _StartMin; }
        set { _StartMin = value; }
    }
    private int _StartMin = int.MinValue;
    #endregion

    #region Property <int> EndHour
    [Property("EndHour", 4, SqlDbType.Int, false, false)]
    public int EndHour
    {
        get { return _EndHour; }
        set { _EndHour = value; }
    }
    private int _EndHour = int.MinValue;
    #endregion

    #region Property <int> EndMin
    [Property("EndMin", 4, SqlDbType.Int, false, false)]
    public int EndMin
    {
        get { return _EndMin; }
        set { _EndMin = value; }
    }
    private int _EndMin = int.MinValue;
    #endregion
    #endregion




}
